package com.sayice.coursetable.logic.dao;

import android.content.Context;

import androidx.room.Database;
import androidx.room.RoomDatabase;

import com.sayice.coursetable.logic.model.Course;
import com.sayice.coursetable.logic.model.CourseTable;

@Database(entities = {CourseTable.class, Course.class}, version = 1)
public abstract class AppDatabase extends RoomDatabase {
    public abstract CourseTableDao courseTableDao();

    public abstract CourseDao courseDao();

    private static AppDatabase instance;

    public static synchronized AppDatabase getInstance(Context context) {
        if (instance == null) {
            instance = androidx.room.Room.databaseBuilder(context.getApplicationContext(),
                    AppDatabase.class, "course_database").build();
        }
        return instance;
    }
}
